package com.controller;


import com.common.Result;
import com.entity.TestUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/test") //前置url
@RestController //相当于@ResponseBody ＋ @Controller,编写的方法默认返回给前端json格式
@Slf4j //打印日志使用
public class TestController {


    @GetMapping("/demo")
    public Result<TestUser> demo(){
        TestUser testUser = new TestUser();
        testUser.setName("zhangsan");
        testUser.setAge("zhangsan");

        return Result.success(testUser);
    }
}
